
import Dimension from '../propertyType/dimension';

export default class Geometry {
    public ctm: DOMMatrix;
    public dim: Dimension;
    public loc: {x: number, y: number};
    constructor() {
        this.ctm = null;
        this.dim = null;
    }

    clone(svg) {
        var geo = new Geometry();
        if (this.dim == null) {
            geo.dim = null;
        } else {
            geo.dim = new Dimension(this.dim.w, this.dim.h);
        }

        if (this.ctm == null) {
            geo.ctm = null;
        } else {
            geo.ctm = svg.createSVGMatrix().multiply(this.ctm);
        }
        if (this.loc) {
            geo.loc = {x: this.loc.x, y: this.loc.y};
        }

        return geo;
    };
}
